﻿<visi:VisiDialog x:Class="VNet.VisiSuite.VisiBoard.Views.DowntimeDialogView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:visi="clr-namespace:VNet.VisiSuite.VisiBoard.Controls"
        xmlns:vuc="clr-namespace:VNet.VisiSuite.Controls;assembly=VNet.VisiSuite.Controls"
        xmlns:vm="clr-namespace:VNet.VisiSuite.VisiBoard.ViewModels" DataContext="{DynamicResource DowntimeDialogViewModel}"
         xmlns:converter="clr-namespace:VNet.VisiSuite.Common.Converters;assembly=VNet.VisiSuite.Common"
        xmlns:c="clr-namespace:VNet.VisiSuite.VisiBoard.Controls" xmlns:helper="clr-namespace:VNet.VisiSuite.VisiBoard.Common.Helpers"
        xmlns:ig="http://schemas.infragistics.com/xaml"
        mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="800" Loaded="VisiDialog_Loaded"
                 >

    <visi:VisiDialog.Resources>
        <vm:DowntimeDialogViewModel x:Key="DowntimeDialogViewModel" />
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
        <converter:InvertBooleanConverter x:Key="InvertBooleanConverter" />
        <converter:InvertBooleanVisibilityConverter x:Key="InvertBooleanVisibilityConverter" />
        <Style x:Key="DowntimeNodeStyle" TargetType="ig:XamDataTreeNodeControl">
            <!-- <Setter Property="FontFamily" Value="Segoe UI"/> -->
            <Setter Property="FontSize" Value="16pt"/>
        </Style>
    </visi:VisiDialog.Resources>
    
    <vuc:BusyIndicator IsBusy="{Binding IsBusy}">

        <Border BorderBrush="#FFE7E7E7" BorderThickness="3,0,0,0">

            <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="#FFFBFBFB" Focusable="False">

                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <!--Header-->
                <StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,8,0,0">
                    <vuc:MetroIconMenu x:Name="_menu" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="2,0,0,0"/>
                    <TextBlock Style="{StaticResource AppFontDialogHeader}" VerticalAlignment="Center" Text="{Binding Heading}" Margin="2,0,0,0"></TextBlock>
                </StackPanel>

                <Grid Margin="12, 8, 12, 8" Grid.Row="1" x:Name="gridProgessBar">
                    <ProgressBar Minimum="0" Maximum="100" Value="0" Name="_progress_bar_status" Height="24pt"/>
                    <TextBlock Name="_progress_bar_text" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16pt" Foreground="White" Margin="0, 4, 0, 4"/>
                </Grid>

                <DockPanel Grid.Row="2" VerticalAlignment="Stretch" Height="Auto" Margin="12,8,12,12">
                    <TextBlock Style="{StaticResource DialogLabelBlueTextBlockStyle}" FontSize="16pt" DockPanel.Dock="Top" Text="{Binding Label}"></TextBlock>
                    <ig:XamDataTree x:Name="_reason_codes"  Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" DockPanel.Dock="Bottom"
                                DisplayMemberPath="Text" NodeLineVisibility="Visible" ItemsSource="{Binding ReasonCodes}"
                                BorderBrush="#FFB9B9B9" Foreground="#FF3F3F3F" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                                FontSize="20pt"
                                SelectedNodesCollectionChanged="_reason_codes_SelectedNodesCollectionChanged">
                        <ig:XamDataTree.GlobalNodeLayouts>
                            <ig:NodeLayout Key="SimpleNodes"
                               DisplayMemberPath="Text"
                               TargetTypeName="SimpleNode"
                               IsExpandedMemberPath="IsExpanded"
                               IsDraggable="False"
                               IsDropTarget="False"
                               NodeStyle="{StaticResource DowntimeNodeStyle}">
                            </ig:NodeLayout>
                        </ig:XamDataTree.GlobalNodeLayouts>
                        <ig:XamDataTree.EditingSettings>
                            <ig:TreeEditingSettings/>
                        </ig:XamDataTree.EditingSettings>
                        <ig:XamDataTree.SelectionSettings>
                            <ig:TreeSelectionSettings NodeSelection="Single"/>
                        </ig:XamDataTree.SelectionSettings>
                    </ig:XamDataTree>
                </DockPanel>

                <StackPanel Grid.Row="3" Orientation="Vertical" Margin="12,8,12,0">
                    <TextBlock  Style="{StaticResource DialogLabelBlueTextBlockStyle}" FontSize="16pt" Text="Enter your operator ID" IsEnabled="False"/>
                    <ig:XamMaskedInput x:Name="_operator_id" Style="{StaticResource PropertyXamMaskedInputStyle}"  Margin="0,0,0,0" SpinButtonDisplayMode="Never"  Mask="nnnnnn"
                        VerticalAlignment="Center" HorizontalAlignment="Left" MinWidth="100" Width="100" AlwaysValidate="False" DisplayMode="Raw" Text="{Binding OperatorCode}" IsEnabled="False">
                    </ig:XamMaskedInput>
                </StackPanel>

                <StackPanel Grid.Row="4" Orientation="Vertical" Margin="12,3,75,8">
                    <TextBlock Style="{StaticResource ErrorTextBlockStyle}" FontSize="16pt" Text="{Binding ValidationError}" TextWrapping="Wrap" />
                </StackPanel>

                <vuc:MetroIconMenu Grid.Row="4" x:Name="_bottom_bar" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="2,0,0,0"/>

            </Grid>

        </Border>

    </vuc:BusyIndicator>
</visi:VisiDialog>
